#ifndef RECEIVEIMAGE_H
#define RECEIVEIMAGE_H


#include <QUdpSocket>
#include <QThread>
#include <QHostAddress>
#include <QCoreApplication>
#include <QFile>
#include <QJsonDocument>
#include <QJsonObject>
#include <QJsonArray>

namespace Ui {
class ReceiveImage;
}

class ReceiveImage : public QThread
{
    Q_OBJECT

public:
    explicit ReceiveImage( QWidget *parent = nullptr);
    ~ReceiveImage();
    bool init();
    void disinit();
    void run() override;
    QUdpSocket *receiver;

public slots:
    void receiveVideo();

signals:
    void sendReceiveImageToWidget(const QImage &image);
private:
    int init_argc;
    char** init_argv;
    int packet_unit = 2048;
    int start_flag;
    QByteArray received_data;   //接受到的数据
    QHostAddress dstip;
};
#endif // ReceiveImage_H

